<div class="top-content">
  <table style="width: 940px;">
    <tr>
      <td class="info_font" style="width: 240px; color: #15bccf"><%= l(:label_osp_community) %></td>
      <td style="width: 200px; color: #15bccf"><strong><%= l(:label_user_location) %> : </strong></td>
      <td rowspan="2">
        <div class="top-content-search" style="float: right;">
          <%#= form_tag(:controller => 'open_source_projects', :action => "search", :method => :get) do %>
          <%#= text_field_tag 'name', params[:name], :size => 20 %>
          <%#= hidden_field_tag 'project_type', params[:project_type] %>
          <%#= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
          <%# end %>
          <%= render :partial => "open_source_projects/search_bar" %>
        </div>
      </td>
    </tr>
    <tr>
      <td style="padding-left: 8px">
        <%= link_to request.host()+"/index", :controller => 'open_source_projects', :action => 'index' %>
      </td>
      <td><%= link_to l(:field_homepage), home_path %>
        >
        <%= link_to '热帖搜索', :controller => 'relative_memos', :action => 'search' %>
      </td>
    </tr>
  </table>
</div>

<!-------------------------css----------------->
<%= javascript_include_tag "ichart.1.2.min" %>
<%= stylesheet_link_tag "buglist-div-use.css" %>
<%= stylesheet_link_tag "buglist-ichart.css" %>
<%= stylesheet_link_tag "buglist.css" %>

<div class="main_content">
<style>
    .information .stats a {
        width: 220px;
        text-align: right;
        display: inline-block;
        font-weight: bold;
        font-style: 1.2em;
    }

    .information .stats span {
        margin-left: 10px;
    }
</style>


<style type="text/css">
    .tb-navigation {
        position: relative;
        z-index: 400;
    }

        /*blockquote, body, button, code, dd, div, dl, dt, fieldset, form, h1, h2, h3, h4, h5, h6, input, legend, li, ol, p, pre, td, textarea, th, ul {
            margin: 0;
            padding: 0;
        }*/

    .navigation {
        color: #666;
        border: 2px solid #d7d6d6;
    }

    .nav-switch {
        position: absolute;
        top: 0;
        right: 0;
        border-width: 14px;
        border-color: #bdbdbd #bdbdbd transparent transparent;
        border-style: solid solid dashed dashed;
        z-index: 10;
    }

    .navigation .nav-switch-icon {
        background-position: -266px 3px;
    }

    .navigation .icon-search, .navigation .nav-pill-cancle, .navigation .nav-switch-icon, .navigation .nav-topbar .topbar-search .topbar-submit, .navigation .nav-topbar-arror {
        /*background: url()*/
    }

    .nav-switch-icon {
        width: 15px;
        height: 15px;
        position: absolute;
        top: -13px;
        right: -13px;
        cursor: pointer;
    }

    .nav-topbar, .type-min {
        position: relative;
    }

    .nav-category-group {
        clear: both;
    }

    .nav-topbar {
        background-color: #f5f4f4;
        border-bottom: 1px solid #e4e4e4;
        z-index: 4;
    }

    .nav-topbar .nav-topbar-content {
        line-height: 36px;
        padding: 0 16px;
        overflow: hidden;
    }

    .nav-topbar-content {
        margin: 0 4px;
        white-space: nowrap;
    }

    ol, ul {
        list-style: none;
    }

    ul, menu, dir {
        display: block;
        list-style-type: disc;
        -webkit-margin-before: 1em;
        -webkit-margin-after: 1em;
        -webkit-margin-start: 0px;
        -webkit-margin-end: 0px;
        -webkit-padding-start: 40px;
    }

    .nav-topbar .nav-topbar-content {
        line-height: 36px;
    }

    li {
        margin-right: 7px;
        float: left;
    }

    .type-line {
        overflow: hidden;
    }

    .nav-category-group {
        clear: both;
    }

    .type-line .nav-category {
        clear: both;
        position: relative;
        padding: 0 100px 0 107px;
        height: 20px;
        overflow: hidden;
        margin-top: 11px;
        margin-bottom: 11px;
    }

    .nav-category h4 {
        position: absolute;
        color: #666;
        font-weight: 400;
        left: 22px;
        top: 0;
        overflow: hidden;
        max-width: 68px;
        white-space: nowrap;
        text-overflow: ellipsis;
        padding-right: 5px;
        text-align: left;
    }

    .nav-search-con {
        padding-top: 7px;
    }
</style>
<div class="results_count" style="font-size: 15px;margin: 0 40px 10px 10px;">
    <span>搜索到 <%=  @topics_count  %> 个结果 </span>
  	<span style="float: right;font-size: 14px;">
  	按&nbsp;
  	<% if "review_num DESC".eql?(@sort_tag) %>
  	<%= link_to "时间",  search_relative_memos_path(@open_source_project, :sort_field => 'created_time DESC', :name => params[:name]), :method => 'get' %>
  	&nbsp;&nbsp;/&nbsp;
  	<%= link_to "回帖 ↓", search_relative_memos_path(@open_source_project, :sort_field => 'review_num ASC', :name => params[:name]), :method => 'get' %>
  	&nbsp;&nbsp;/&nbsp;
  	<%= link_to "关联度", search_relative_memos_path(@open_source_project, :sort_field => '', :name => params[:name]), :method => 'get' %>
  	
  	<% elsif "created_time DESC".eql?(@sort_tag) %>
  	<%= link_to "时间 ↓", search_relative_memos_path(@open_source_project, :sort_field => 'created_time ASC', :name => params[:name]), :method => 'get' %>
  	&nbsp;&nbsp;/&nbsp;
  	<%= link_to "回帖", search_relative_memos_path(@open_source_project, :sort_field => 'review_num DESC', :name => params[:name]), :method => 'get' %>
  	&nbsp;&nbsp;/&nbsp;
  	<%= link_to "关联度", search_relative_memos_path(@open_source_project, :sort_field => '', :name => params[:name]), :method => 'get' %>
  	
  	<% elsif "".eql?(@sort_tag) %>
  	<%= link_to "时间", search_relative_memos_path(@open_source_project, :sort_field => 'created_time DESC', :name => params[:name]), :method => 'get' %>
  	&nbsp;&nbsp;/&nbsp;
  	<%= link_to "回帖", search_relative_memos_path(@open_source_project, :sort_field => 'review_num DESC', :name => params[:name]), :method => 'get' %>
  	&nbsp;&nbsp;/&nbsp;
  	<%= link_to "关联度", search_relative_memos_path(@open_source_project, :sort_field => '', :name => params[:name]), :method => 'get' %>
  	
  	
  	<% elsif "review_num ASC".eql?(@sort_tag) %>
  	<%= link_to "时间", search_relative_memos_path(@open_source_project, :sort_field => 'created_time DESC', :name => params[:name]), :method => 'get' %>
  	&nbsp;&nbsp;/&nbsp;
  	<%= link_to "回帖 ↑", search_relative_memos_path(@open_source_project, :sort_field => 'review_num DESC', :name => params[:name]), :method => 'get' %>
  	&nbsp;&nbsp;/&nbsp;
  	<%= link_to "关联度", search_relative_memos_path(@open_source_project, :sort_field => '', :name => params[:name]), :method => 'get' %>
  	
  	<% elsif "created_time ASC".eql?(@sort_tag) %>
  	<%= link_to "时间 ↑", search_relative_memos_path(@open_source_project, :sort_field => 'created_time DESC', :name => params[:name]), :method => 'get' %>
  	&nbsp;&nbsp;/&nbsp;
  	<%= link_to "回帖", search_relative_memos_path(@open_source_project, :sort_field => 'review_num DESC', :name => params[:name]), :method => 'get' %>
  	&nbsp;&nbsp;/&nbsp;
  	<%= link_to "关联度", search_relative_memos_path(@open_source_project, :sort_field => '', :name => params[:name]), :method => 'get' %>
  	
  	<% else %>
  	<%= link_to "时间", search_relative_memos_path(@open_source_project, :sort_field => 'created_time DESC', :name => params[:name]), :method => 'get' %>
  	&nbsp;&nbsp;/&nbsp;
  	<%= link_to "回帖", search_relative_memos_path(@open_source_project, :sort_field => 'review_num DESC', :name => params[:name]), :method => 'get' %>
  	&nbsp;&nbsp;/&nbsp;
  	<%= link_to "关联度", search_relative_memos_path(@open_source_project, :sort_field => '', :name => params[:name]), :method => 'get' %>
  	<% end %>
  	
  	&nbsp;排序
  	
  </span>
</div>
<div id="projects-index">

  <ul class='projects'>
    <% for i in (0..@topics.length-1) %>
    	<% topic = @topics[i] %>
        <% if !topic.nil? %>
            <li class='project-table'>
              <div class='root'>
                <%= link_to topic.title, topic.url, :class => "project root leaf", :onclick => "return user_trace_click_knowledge_in_knowledge_list_after_search('#{topic.id}','#{@topics_pages.page}','#{i+1}','#{request.session_options[:id]}','#{@sort_tag}');" %>
                <span style="float: right;"></span>

                <div class="project-block">
                  <div class="wiki-description">
                    <p>
                      <%#= textilizable(short_desc(topic.content,25)) %>
                      <%= topic.short_content %>
                    </p>
                  </div>

                  <div class="information">
                    <p class="stats">
                      <!--%= link_to project_info.followers_num, open_source_project_path(project) %-->
                      <a>
                        <%= topic.review_num %>
                      </a>
                      <%= content_tag('span', l(:label_review_num)) %>
                    </p>

                    <!-- <p class="stats">
                      <!--%= link_to project_info.download_num, open_source_project_path(project) %-->
                      <a>
                        <%#= topic.collection_num %>
                      </a>
                      <%#= content_tag('span', l(:label_collection_num)) %>
                    </p> -->

                    <p class="stats">
                      <!--%= link_to project_info.visit_num, open_source_project_path(project) %-->
                      <a>
                        <!-- <%= topic.view_num+topic.view_num_ossean %> -->
                      </a>
                      <!-- <%= content_tag('span', l(:label_view_num)) %> -->
                    </p>
                    <!--<p class="stats">-->
                    <!--%=link_to project.code_line %-->
                    <!--%= content_tag('span',  "行代码") %-->
                    <!--</p>-->
                  </div>


                </div>
                <div class="add-info">
                  <!--<div class="main-language">-->

                  <!--<%= content_tag('span', "#{l(:default_role_manager)}: ") %>-->

                  <!--</div>-->
                  <div class="licences">
                    <%= content_tag('span', "#{l(:label_create_time)}: ") %>
                    <%= content_tag('span', topic.created_time.to_s[0,10]) %>
                  </div>

                  <!--gcm-->
                  <!--</div>-->
                  <!--<div class="url">-->
                  <!--gcm end-->
                  <div class="main-language">
                    <%= content_tag('span', "帖子来源：") %><%= link_to topic.url, topic.url, :onclick => "return user_trace_click_knowledge_in_knowledge_list_after_search('#{topic.id}','#{@topics_pages.page}','#{i+1}','#{request.session_options[:id]}');" %>
                  </div>
                  <!--<div class="licences">-->
                  <!--<%= content_tag('span', "数据更新时间:") %><%#= content_tag('span', topic.crawled_time) %>-->
                  <!--</div>-->
                </div>
                <div class="tags">
                  <div id="tags">
                    <%= image_tag("/images/sidebar/tags.png") %>
                    <%= render :partial => 'tags/tag_name', :locals => {:obj => topic, :object_flag => "9", :non_list_all => true} %>
                  </div>
                </div>

              </div>

            </li>
        <% end %>
    <% end %>
  </ul>
</div>

<div class="pagination">
  <ul>
    <%= pagination_links_full @topics_pages, @topics_count %>
  </ul>
</div>
</div>
<% html_title(l(:label_topics_search)) -%>

<!-- ajax user trace zhangxunhui begin -->
<script type="text/javascript">
	function user_trace_click_knowledge_in_knowledge_list_after_search(id,page,rank,session_id,sort){
		if(sort == ""){
			sort = "relation DESC"
		}
		//读取URL中的关键词
		url = document.URL; //已经被编码了
		keyword = url.substring(url.indexOf("name=")+5);
    	$.ajax({
			contentType: "application/json; charset=utf-8",
			timeout: 5000,
			url: '/user_traces/click_knowledge_after_search?page=' + page + "&rank=" + rank + "&id=" + id + "&keyword=" + keyword + "&session_id=" + session_id + "&sort=" + sort,
			dataType: "json"
		});
	}
</script>
<!-- ajax user trace zhangxunhui end -->